package cliente;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;

public class ClienteAviao extends JFrame implements ActionListener{

	public ClienteAviao(){
		initComponents();
		aterrarButton.addActionListener(this);
		descolarButton.addActionListener(this);
		libertarButton.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e){		
		if (e.getActionCommand().equals("Aterrar"))
			new ClienteSocket("a");								
		else if (e.getActionCommand().equals("Descolar"))
			new ClienteSocket("d");
		else if (e.getActionCommand().equals("Libertar"))
			new ClienteSocket("l");
		else
			System.out.println("Error in client interface");
	}

    @SuppressWarnings("unchecked")
    private void initComponents() {
    	aterrarButton = new javax.swing.JButton("Aterrar");
    	descolarButton = new javax.swing.JButton("Descolar");
    	libertarButton = new javax.swing.JButton("Libertar");
        msgServTextField = new javax.swing.JTextField("mensagem do servidor");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setAlwaysOnTop(true);
        setTitle("Cliente Aviao");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(descolarButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(aterrarButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(libertarButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(msgServTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(33, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(61, Short.MAX_VALUE)
                .addComponent(aterrarButton)
                .addGap(33, 33, 33)
                .addComponent(descolarButton)
                .addGap(30, 30, 30)
                .addComponent(libertarButton)
                .addGap(28, 28, 28)
                .addComponent(msgServTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(59, 59, 59))
        );
        pack();
    }

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ClienteAviao().setVisible(true);
            }
        });
    }
    private javax.swing.JButton aterrarButton;
    private javax.swing.JButton descolarButton;
    private javax.swing.JButton libertarButton;
    private javax.swing.JTextField msgServTextField;
}
